import request from '@/utils/request'
import { getValue } from '@/utils/auth'
const tenantCode = getValue('tenantCode') || 'T000010'

// 消毒记录 列表
export const disinfectionListPages = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/DisinfectionRecord/queryListPage',
    params: {
      tenantCode,
      ...params
    }
  })
}
// 消毒记录 新增
export const disinfectionSave = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/DisinfectionRecord/save',
    data: {
      tenantCode,
      ...data,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 推荐工作列表
export const queryBreedingAreaSheepNum = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/HouseInfo/queryBreedingAreaSheepNum',
    params: {
        tenantCode,
      ...params
    }
  })
}
// 根据舍信息、阶段ID查询 阶段下的羊只信息
export const breedStandard = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/breedStandard/queryBreedOperationIndividualList',
    params: {
        tenantCode,
      ...params
    }
  })
}
// 根据舍信息、阶段ID查询 阶段下的所有操作信息 以及羊只数量信息
export const queryBreedOperationList = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/breedStandard/queryBreedOperationList',
    params: {
        tenantCode,
      ...params
    }
  })
}
// 消毒记录 修改
export const disinfectionEdit = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/DisinfectionRecord/update/' + data.id,
    data: {
      tenantCode,
      ...data,
      subjectInfoId: getValue('subjectInfoId') || 1

    }
  })
}
// 消毒记录 删除
export const disinfectionDel = (id) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/DisinfectionRecord/delete/' + id,
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 消毒记录 详情
export const disinfectionRecordDetail = id => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/DisinfectionRecord/queryDetail/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 羊只档案详情
export const sheepDetail = (id) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/queryDetail/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}

// 饲喂记录详情
export const feedingDetail = (id) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/feedingRecord/queryDetail/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 舍列表
export const queryHouseInfoStat = () => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/queryHouseInfoStat',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 圈列表
export const queryCircleInfoStat = (houseInfoId) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/queryCircleInfoStat',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      houseInfoId
    }
  })
}
// 列表
export const listPage = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/queryListPage',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || '',
      ...params
    }
  })
}
// 列表3级所有数据
export const query4Select = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/query4Select',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      loginUserId: getValue('loginUserId') || '',

      ...params
    }
  })
}
// 列表2级所有数据
export const query4CircleSelect = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/individual/query4CircleSelect',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 查询存栏数总数量和舍数量
export const totalLiveStockNumber = () => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/HouseInfo/queryTotalLivestockNumber',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 舍信息列表分页（带圈数量和养殖数量）
export const numberOfCirclesPage = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/HouseInfo/queryNumberOfCirclesPage',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 标准化管理消息列表
export const messageRecord = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/messageRecord/queryListPage',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 消息处理
export const messageHandle = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/messageRecord/handle',
     params: {
      tenantCode,
      ...data
    }
  })
}
// 获取舍未读消息数量
export const unHandleCount = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/messageRecord/getUnHandleCount',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 查看耳标号-所有的圈和个体
export const queryCricleList2 = (id) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/operationRecord/queryCricleList2/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }

  })
}
// 请求字典
export const dictionaryList = (pCode) => {
  return request({
    method: 'GET',
    url: '/agri/api/common/businessData/queryList',
    params: {
      pCode,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 使用药品
export const ypList = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/drugInfo/queryList',
    params: {
       tenantCode,
      typeCode: 'T000010_VETERINARYDRUGS',
      ...params
    }
  })
}
// 疾病诊疗记录-新增
export const diseaseTreatRecordSave = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/diseaseTreatRecord/save',
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...data
    }
  })
}
// 诊疗记录-列表
export const diseaseTreatRecordListPage = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/diseaseTreatRecord/queryListPage',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 诊疗记录-详情
export const diseaseTreatRecordDetail = (id) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/diseaseTreatRecord/queryDetail/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 诊疗记录-删除
export const diseaseTreatRecordDelete = (id) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/diseaseTreatRecord/delete/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 诊疗记录-修改
export const diseaseTreatRecordUpdate = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/diseaseTreatRecord/update/' + data.id,
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...data
    }
  })
}
// 采精记录-列表
export const semenRecordListPage = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/semenRecord/queryListPage',
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 采精记录-详情
export const semenRecordDetail = (id) => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/semenRecord/queryDetail/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 采精记录-删除
export const semenRecordDelete = (id) => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/semenRecord/delete/' + id,
    params: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1
    }
  })
}
// 采精记录-新增
export const semenRecordSave = data => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/semenRecord/save',
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...data
    }
  })
}
// 采精记录-新增
export const semenRecordUpdate = data => {
  return request({
    method: 'POST',
    url: '/agri/api/yzbzh/semenRecord/update/' + data.id,
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...data
    }
  })
}
// 档案详情-生长记录
export const growRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/growRecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-疫苗接种记录
export const vaccinationRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/vaccinationRecord/queryRecoredListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-配种记录
export const breedRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/breedRecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-其他记录
export const otherListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/otherRecord/queryRecoredListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 价格列表
export const customized = (params) => {
  return request({
    method: 'GET',
    url: '/agri/api/common/price/queryListPage',
   params: {
      tenantCode,
      ...params
    }
  })
}
// 全部品种
export const queryTypes = () => {
  return request({
    method: 'GET',
    url: '/agri/api/common/businessData/queryList4Amis',
    params: {
        tenantCode,
      pCode: 'T000010_VARIETIES_TYPE_CODE'
    }
  })
}
// 档案详情-配种记录
export const changeCircleRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/changeCircleRecord/queryRecoredListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      ...params
    }
  })
}
// 档案详情-离场记录
export const departureRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/departureRecord/queryRecoredListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-受孕确认记录
export const pregnancyRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/pregnancyRecord/queryRecordListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-饲喂记录
export const feedingRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/feedingRecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-产羔记录
export const lambingRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/lambingRecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-病死无害化处理记录
export const dieHarmlesshandleListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/dieHarmlesshandle/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-病死无害化处理记录
export const dieHarmlesshandleListPageOwn = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/dieHarmlesshandle/queryRecoredListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-保险记录
export const insurancerecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/insurancerecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 档案详情-产奶记录
export const milkProductionRecordListPage = params => {
  return request({
    method: 'GET',
    url: '/agri/api/yzbzh/milkProductionRecord/queryListPage',
    params: {
      page: 1,
      perPage: 1000,
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...params
    }
  })
}
// 专家职称
export const expertTitleQueryList = () => {
  return request({
    method: 'GET',
    url: '/agri/api/sshfw/expertTitle/queryList',
     params: {
      tenantCode,
    }
  })
}
// 专家分类
export const businessData = () => {
  return request({
    method: 'GET',
    url: '/agri/api/common/businessData/queryList4Amis',
    params: {
      tenantCode,
      pcode: 'T000010_BIZ_EXPERT_TYPE'
    }
  })
}
// 行情价格
export const priceQueryList = (data) => {
  return request({
    method: 'POST',
    url: '/datamofcom/front/price/pricequotation/priceQueryList',
    params: {
      tenantCode,
      pageNumber: 1,
      pageSize: 10000,
      ...data
    }
  })
}
// 擅长领域
export const businessData4Amis = () => {
  return request({
    method: 'GET',
    url: '/agri/api/common/businessData/queryList4Amis',
    params: {
      tenantCode,
      pCode: 'T000010_BIZ_EXPERT_TYPE'
    }
  })
}
// 专家职称
export const expertTitle = () => {
  return request({
    method: 'GET',

    url: '/agri/api/common/expertTitle/queryList',
    data: {
      tenantCode,
      page: 1,
      perPage: 100
    }
  })
}
// 新增 专家xinxi1
export const subjectInfoExpert = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/common/subjectInfoExpert/save',
    data: {
      tenantCode,
      ...data
    }
  })
}
// 发送验证码
export const sendVerifyCodeForRegister = (data) => {
  return request({
    method: 'put',
    url: '/agri/api/common/tenant/sendVerifyCodeForRegister?loginNameTemp=' + data.loginNameTemp,
     data: {
      tenantCode,
      ...data
    }
  })
  // return request.put('/agri/api/common/tenant/sendVerifyCodeForRegister?loginNameTemp=' + loginNameTemp, data)
}
// 注册
export const register = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/common/register/register4Normal',
    data: {
      tenantCode,
      ...data
    }
  })
}
// 审核结果信息
export const subjectInfoExpertData = (userId) => {
  return request({
    method: 'GET',
    url: '/agri/api/common/subjectInfoExpert/queryDetailByUserId',
    params: {
      tenantCode,
      userId
    }
  })
}
// 快速提问
export const ystw = (data) => {
  return request({
    method: 'POST',
    url: '/agri/api/common/questionInfo/save',
    data: {
      tenantCode,
      subjectInfoId: getValue('subjectInfoId') || 1,
      ...data
    }
  })
}
